package com.ptu.mapper;

import com.github.pagehelper.Page;
import com.ptu.annotation.AutoFill;
import com.ptu.dto.CategoryPageQueryDTO;
import com.ptu.entity.Banner;
import com.ptu.entity.Category;
import com.ptu.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BannerMapper {

    /**
     * 插入数据
     * @param banner
     */
    @Insert("insert into banner(url, store_id, create_time)" +
            " VALUES" +
            " (#{url}, #{storeId}, #{createTime})")
    void insert(Banner banner);

    /**
     * 根据 storeId 查询对应的所有 Banner 数据
     * @param storeId 店铺 ID
     * @return 符合条件的 Banner 列表
     */
    @Select("SELECT * FROM banner WHERE store_id = #{storeId}")
    List<Banner> selectByStoreId(Long storeId);

    /**
     * 根据 storeId 删除对应记录
     * @param storeId 店铺 ID
     * @return 删除的记录数量
     */
    @Delete("DELETE FROM banner WHERE store_id = #{storeId}")
    int deleteByStoreId(Long storeId);
}
